{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "fc726a91",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "806de294",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "c2ccd72c",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "df = pd.DataFrame(\n",
    "    {f\"Sample{i}\": np.random.uniform(i, i*10, 200) for i in range(1, 7)}\n",
    ")\n",
    "df = df.rename(columns={\"Sample1\": \"X\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "75b16dac",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "3a9bf93e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>X</th>\n",
       "      <th>Sample2</th>\n",
       "      <th>Sample3</th>\n",
       "      <th>Sample4</th>\n",
       "      <th>Sample5</th>\n",
       "      <th>Sample6</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5.781354</td>\n",
       "      <td>16.358811</td>\n",
       "      <td>15.889315</td>\n",
       "      <td>16.821910</td>\n",
       "      <td>9.261662</td>\n",
       "      <td>27.062360</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.636109</td>\n",
       "      <td>7.427356</td>\n",
       "      <td>9.053093</td>\n",
       "      <td>32.372009</td>\n",
       "      <td>22.524471</td>\n",
       "      <td>20.849828</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2.964044</td>\n",
       "      <td>8.605052</td>\n",
       "      <td>25.147804</td>\n",
       "      <td>20.068732</td>\n",
       "      <td>21.959518</td>\n",
       "      <td>24.224787</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2.745892</td>\n",
       "      <td>10.363995</td>\n",
       "      <td>26.898752</td>\n",
       "      <td>36.882023</td>\n",
       "      <td>14.757217</td>\n",
       "      <td>27.977068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>9.418099</td>\n",
       "      <td>18.210987</td>\n",
       "      <td>23.908537</td>\n",
       "      <td>23.391942</td>\n",
       "      <td>17.251023</td>\n",
       "      <td>32.180930</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>5.771590</td>\n",
       "      <td>18.865074</td>\n",
       "      <td>26.914847</td>\n",
       "      <td>32.295184</td>\n",
       "      <td>22.198167</td>\n",
       "      <td>19.372139</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>3.684816</td>\n",
       "      <td>17.820088</td>\n",
       "      <td>13.893438</td>\n",
       "      <td>31.858346</td>\n",
       "      <td>10.088827</td>\n",
       "      <td>57.322652</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>6.890381</td>\n",
       "      <td>15.854849</td>\n",
       "      <td>13.028513</td>\n",
       "      <td>33.091527</td>\n",
       "      <td>20.567658</td>\n",
       "      <td>42.526867</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>8.613922</td>\n",
       "      <td>7.137236</td>\n",
       "      <td>17.461935</td>\n",
       "      <td>35.993641</td>\n",
       "      <td>31.075266</td>\n",
       "      <td>38.661414</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>4.301848</td>\n",
       "      <td>18.313081</td>\n",
       "      <td>15.513522</td>\n",
       "      <td>23.379708</td>\n",
       "      <td>13.872357</td>\n",
       "      <td>35.510300</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            X    Sample2    Sample3    Sample4    Sample5    Sample6\n",
       "0    5.781354  16.358811  15.889315  16.821910   9.261662  27.062360\n",
       "1    1.636109   7.427356   9.053093  32.372009  22.524471  20.849828\n",
       "2    2.964044   8.605052  25.147804  20.068732  21.959518  24.224787\n",
       "3    2.745892  10.363995  26.898752  36.882023  14.757217  27.977068\n",
       "4    9.418099  18.210987  23.908537  23.391942  17.251023  32.180930\n",
       "..        ...        ...        ...        ...        ...        ...\n",
       "195  5.771590  18.865074  26.914847  32.295184  22.198167  19.372139\n",
       "196  3.684816  17.820088  13.893438  31.858346  10.088827  57.322652\n",
       "197  6.890381  15.854849  13.028513  33.091527  20.567658  42.526867\n",
       "198  8.613922   7.137236  17.461935  35.993641  31.075266  38.661414\n",
       "199  4.301848  18.313081  15.513522  23.379708  13.872357  35.510300\n",
       "\n",
       "[200 rows x 6 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "743cd87c",
   "metadata": {},
   "outputs": [],
   "source": [
    "long_df = df.melt(id_vars=\"X\", var_name=\"Var\", value_name=\"Value\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "13c08b77",
   "metadata": {},
   "outputs": [],
   "source": [
    "long_df.to_csv(\"input.csv\", sep=\",\", encoding=\"utf-8\", index=False, header=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "cdbef012",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_excel(\"example.xlsx\", index=False, header=True, engine=\"openpyxl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "973c094e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "notebooks",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
